package com.lizhi.menu.service.impl;

import com.lizhi.menu.domain.Notify;
import com.lizhi.menu.mapper.NotifyMapper;
import com.lizhi.menu.service.INotifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 公告Service业务层处理
 * 
 * @author lizhi
 * @date 2023-05-19
 */
@Service
public class NotifyServiceImpl implements INotifyService 
{
    @Autowired
    private NotifyMapper notifyMapper;

    /**
     * 查询公告
     * 
     * @param id 公告主键
     * @return 公告
     */
    @Override
    public Notify selectNotifyById(Long id)
    {
        return notifyMapper.selectById(id);
    }

    /**
     * 查询公告列表
     * 
     * @param notify 公告
     * @return 公告
     */
    @Override
    public List<Notify> selectNotifyList(Notify notify)
    {
        return notifyMapper.selectNotifyList(notify);
    }

    /**
     * 新增公告
     * 
     * @param notify 公告
     * @return 结果
     */
    @Override
    public int insertNotify(Notify notify)
    {
        notify.setCreateTime(LocalDateTime.now());
        return notifyMapper.insertNotify(notify);
    }

    /**
     * 修改公告
     * 
     * @param notify 公告
     * @return 结果
     */
    @Override
    public int updateNotify(Notify notify)
    {
        return notifyMapper.updateNotify(notify);
    }

    /**
     * 批量删除公告
     * 
     * @param ids 需要删除的公告主键
     * @return 结果
     */
    @Override
    public int deleteNotifyByIds(Long[] ids)
    {
        return notifyMapper.deleteNotifyByIds(ids);
    }

    /**
     * 删除公告信息
     * 
     * @param id 公告主键
     * @return 结果
     */
    @Override
    public int deleteNotifyById(Long id)
    {
        return notifyMapper.deleteNotifyById(id);
    }
}
